package com.cykj.eurekaclient.service.impl;

import com.cykj.eurekaclient.bean.*;
import com.cykj.eurekaclient.mapping.UserMapper;
import com.cykj.eurekaclient.service.AdminService;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @version 1.0
 * @author: 蜜糖
 * @date: 2021/9/19 9:08
 * @desc:
 */
@Service
public class AdminServiceImpl implements AdminService {

    /*
        站点配置相关方法
     */

    @Autowired
    private UserMapper userMapper;

    @Override
    public int selUserAll() {
        int count = userMapper.selUserAll();
        return count;
    }

    /*
        站点配置相关方法    ------------------------------------------------
     */

    @Override
    public int selectCount() {
        return userMapper.selectCount();
    }


    @Override
    public boolean deleteRow(Integer id) {
        try {
            userMapper.deleteRow(id);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }


    @Override
    public List<CityInfo> selCityExist(String cityStr,String district) {
        return userMapper.selCityExist(cityStr,district);
    }

//    @Override
//    public List<StationInfo> findSite(RowBounds rowBounds, String name) {
//        return userMapper.findSite(rowBounds, name);
//    }


    @Override
    public boolean insertSite(StationInfo stationInfo, String district) {
        try {
            userMapper.insertSite(stationInfo, district);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public List<StationInfo> findSiteNameInfo(String name) {
        return userMapper.findSiteNameInfo(name);
    }

    @Override
    public List<RouteInfo> getLineInfo(RowBounds rowBounds,String routeName) {
        return userMapper.getLineInfo(rowBounds,routeName);
    }

    /*
        线路配置相关方法    ----------------------------------------------
     */

    @Override
    public int selectLineInfoCount() {
        return userMapper.selectLineInfoCount();
    }

    @Override
    public boolean deleteRouteRow(Integer id) {
        try {
            userMapper.deleteRouteRow(id);
        } catch (Exception e){
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public boolean updateRouteRow(RouteInfo routeInfo, Long id) {
        try {
            userMapper.updateRouteRow(routeInfo, id);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public List<RouteInfo> findRoute(RowBounds rowBounds, String routeName) {
        return userMapper.findRoute(rowBounds, routeName);
    }

    @Override
    public int routeCount(String routeName) {
        return userMapper.routeCount(routeName);
    }

    @Override
    public boolean insertRoute(RouteInfo routeInfo) {
        try {
            userMapper.insertRoute(routeInfo);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public List<RouteInfo> findRouteName(String name) {
        return userMapper.findRouteName(name);
    }

    @Override
    public List<StationInfo> findSiteInfo() {
        return userMapper.findSiteInfo();
    }

    @Override
    public List<StationInfo> findSiteName() {
        return userMapper.findSiteName();
    }

    @Override
    public List<StationInfo> findLng() {
        return userMapper.findLng();
    }

    @Override
    public List<StationInfo> findLat() {
        return userMapper.findLat();
    }

    /*
        班车班次时刻表配置相关方法    ----------------------------------------------
     */

    @Override
    public List<RouteTimeNode> getBusTime(RowBounds rowBounds, String routeStr) {
        return userMapper.getBusTime(rowBounds,routeStr);
    }

    @Override
    public int selectBusTimeCount(String routeStr) {
        return userMapper.selectBusTimeCount(routeStr);
    }

    @Override
    public boolean deleteBusTimeRow(Integer id) {
        try {
            userMapper.deleteBusTimeRow(id);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public List<RouteInfo> routeIdOptions() {
        return userMapper.routeIdOptions();
    }

    @Override
    public List<Parameter> timePOptions() {
        return userMapper.timePOptions();
    }

    @Override
    public List<Parameter> stateOptions() {
        return userMapper.stateOptions();
    }

    @Override
    public boolean insertBusTime(RouteTimeNode routeTimeNode) {
        try {
            userMapper.insertBusTime(routeTimeNode);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public boolean updateBusTimeRow(String routeStr,String timeParagraphStr,String timeNode,Object state, Long id) {
        try {
            userMapper.updateBusTimeRow(routeStr, timeParagraphStr, timeNode, state, id);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }


    @Override
    public boolean updateRow(StationInfo stationInfo, Long id) {
        try {
            userMapper.updateRow(stationInfo, id);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public BackUser Login(BackUser user) {
        return userMapper.Login(user);
    }

    @Override
    public List<BackUser> find(RowBounds rowBounds) {
        return userMapper.find(rowBounds);
    }

    @Override
    public int selectCount1() {
        return userMapper.selectCount1();
    }


    @Override
    public List<StationInfo> findSiteInfo(RowBounds rowBounds,String name) {
        return userMapper.findSiteInfo(rowBounds,name);
    }

    @Override
    public List<BackUser> findSite1(RowBounds rowBounds, String name) {
        return userMapper.findSite1(rowBounds, name);
    }

    @Override
    public int siteCount1(String name) {
        return userMapper.siteCount1(name);
    }

    @Override
    public int siteCount(String name) {
        return userMapper.siteCount(name);
    }

    @Override
    public boolean deleteRow1(Integer id) {
        try {
            userMapper.deleteRow1(id);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }


    @Override
    public boolean updateRow1(String accountState, long id,String password) {
        try {
            userMapper.updateRow1(accountState, id,password);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public boolean insertSite1(BackUser backUser) {
        try {
            userMapper.insertSite1(backUser);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public List<FrontUser> Ffind(RowBounds rowBounds) {
        return userMapper.Ffind(rowBounds);
    }

    @Override
    public int FselUserAll() {
        return userMapper.FselUserAll();
    }


    /*
        城市信息配置相关方法  ---------------------------------------------
     */

    @Override
    public List<RouteTimeNode> getCityInfo(RowBounds rowBounds, String name) {
        return userMapper.getCityInfo(rowBounds,name);
    }

    @Override
    public int selectCityInfoCount() {
        return userMapper.selectCityInfoCount();
    }

    @Override
    public boolean deleteCityInfoRow(Integer id) {
        try {
            userMapper.deleteCityInfoRow(id);
        }catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public List<CityInfo> findCityName(RowBounds rowBounds, String name) {
        return userMapper.findCityName(rowBounds,name);
    }

    @Override
    public int cityCount(String name) {
        return userMapper.cityCount(name);
    }

    /*
        站点分配表配置相关方法  ---------------------------------------------
     */

    @Override
    public List<StationAssign> getTravelSite(RowBounds rowBounds,String routeStr) {
        return userMapper.getTravelSite(rowBounds,routeStr);
    }

    @Override
    public int selectTravelSiteCount(String routeStr) {
        return userMapper.selectTravelSiteCount(routeStr);
    }

    @Override
    public boolean insertCity(String name, String parentName,String district) {
        try {
            userMapper.insertCity(name, parentName,district);
        }catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public List<CityInfo> findCityNameInfo(String name) {
        return userMapper.findCityNameInfo(name);
    }

    @Override
    public boolean updateCityRow(String name, String parentName,String district, Long id) {
        try {
            userMapper.updateCityRow(name, parentName,district, id);
        }catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public List<RouteInfo> routeNameOptions() {
        return userMapper.routeNameOptions();
    }

    @Override
    public List<StationInfo> stationOptions() {
        return userMapper.stationOptions();
    }

    @Override
    public boolean deleteTravelSiteRow(Integer id) {
        try {
            userMapper.deleteTravelSiteRow(id);
        }catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public boolean insertTravelSite(String routeStr, String stationStr,Long sequence) {
        try {
            userMapper.insertTravelSite(routeStr, stationStr, sequence);
        }catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public List<StationAssign> findTravelSiteName(String stationStr, Long sequence) {
        return userMapper.findTravelSiteName(stationStr, sequence);
    }

    @Override
    public boolean updateTravelSiteRow(String routeStr, String stationStr, Long sequence, Long id) {
        try {
            userMapper.updateTravelSiteRow(routeStr, stationStr, sequence, id);
        }catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public List<FrontUserFlowRecord> findCollectMoney() {
        return userMapper.findCollectMoney();
    }

    @Override
    public List<FrontUserFlowRecord> collectMoneyRoute() {
        return userMapper.collectMoneyRoute();
    }

    @Override
    public int allTakeIn() {
        return userMapper.allTakeIn();
    }



    @Override
    public boolean FinsertSite(FrontUser frontUser) {
        try {
            userMapper.FinsertSite(frontUser);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public List<FrontUser> FfindSite(RowBounds rowBounds, String name) {
        return userMapper.FfindSite(rowBounds, name);
    }

    @Override
    public int FsiteCount(String name) {
        return userMapper.FsiteCount(name);
    }



    @Override
    public boolean FdeleteRow(Integer id) {
        try {
            userMapper.FdeleteRow(id);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }



    @Override
    public boolean FupdateRow(String accountState, long id, String password) {
        try {
            userMapper.FupdateRow(accountState, id,password);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public List<Parameter> Pfind(RowBounds rowBounds) {
        return userMapper.Pfind(rowBounds);
    }

    @Override
    public int PselUserAll() {
        return userMapper.PselUserAll();
    }

    @Override
    public boolean PdeleteRow(Integer id) {
        try {
            userMapper.PdeleteRow(id);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public List<Parameter> PfindSite(RowBounds rowBounds, String name) {
        return userMapper.PfindSite(rowBounds,name);
    }

    @Override
    public int PsiteCount(String name) {
        return userMapper.PsiteCount(name);
    }

    @Override
    public boolean PinsertSite(Parameter parameter) {
        try {
            userMapper.PinsertSite(parameter);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public boolean PupdateRow(String name, long id, String type, long parentId) {
        try {
            userMapper.PupdateRow(name, id, type, parentId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public List<MenuInfo> qxgl() {
        return userMapper.qxgl();
    }

    @Override
    public List<Parameter> xlfind() {
        return userMapper.xlfind();
    }


}
